package com.plian.system.wrapper.pm.property;

import com.plian.system.entity.pm.property.*;
import com.plian.system.vo.pm.property.PropertyBasicsVO;
import com.plian.system.vo.pm.property.SmallPropertyBasicsVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: gangan
 * @create: 2022-05-10 10:40
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface PropertyBasicsWrapper {

    /**
     * entity To smllVO
     * @param entity
     * @return
     */
    SmallPropertyBasicsVO entityToSmallVO(PropertyBasics entity);

    /**
     * entity To smllVO
     * @param entity
     * @return
     */
    List<SmallPropertyBasicsVO> entityToSmallVO(List<PropertyBasics> entity);

    /**
     * entity to vo
     * @param entity
     * @return
     */
    @Mappings(value = {
            @Mapping(source = "netWorking", target = "netWorkingName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "stateFundedRelation", target = "stateFundedRelationName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "functionalCategoryName", target = "functionalCategoryNameName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "majorIndustries", target = "majorIndustriesNames", qualifiedByName = DICT_CODE_LIST_TO_NAME),
            @Mapping(source = "majorIndustries", target = "majorIndustriesNameList", qualifiedByName = DICT_CODE_LIST_TO_NAME_LIST),
            @Mapping(source = "managementCondition", target = "managementConditionName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "orgCategory", target = "orgCategoryName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "orgGradation", target = "orgGradationName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "organizationForm", target = "organizationFormName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "paidCurrency", target = "paidCurrencyName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "situation", target = "situationName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "stateOwnedInstitution", target = "stateOwnedInstitutionName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "subscribedCurrency", target = "subscribedCurrencyName", qualifiedByName = DICT_CODE_TO_NAME)
    })
    PropertyBasicsVO entityToVO(PropertyBasics entity);

    @Mappings({
            @Mapping(target = "id", ignore = true),
            @Mapping(target = "updateTime", ignore = true)
    })
    PropertyRecord basicsToRecord(PropertyBasics propertyBasics);

    ContributorRecord contributorBasicsToRecord(ContributorBasics basics);

    List<ContributorRecord> contributorBasicsToRecord(List<ContributorBasics> basics);

    ShareholdingRecord shareholdingBasicsToRecord(ShareholdingBasics basics);

    List<ShareholdingRecord> shareholdingBasicsToRecord(List<ShareholdingBasics> basics);

    PartnerSituationRecord situationBasicsToRecord(PartnerSituationBasics basics);

    List<PartnerSituationRecord> situationBasicsToRecord(List<PartnerSituationBasics> basics);

    PartnerOutboundRecord outboundBasicsToRecord(PartnerOutboundBasics basics);

    List<PartnerOutboundRecord> outboundBasicsToRecord(List<PartnerOutboundBasics> basics);
}
